﻿@{
    ViewBag.Title = "组织架构";
}

@model Web.Models.TAStructureModel


<div id="main_content" style="margin-left: 0px;">

    <div class="main-wrapper-content">
        <div class="breadcrumb" style="margin-top: 71px;">
            <a href="javascript:;">首页</a> >
            <a href="javascript:;">组织架构</a>
            <input type="button" value="添加" id="AddUser" class="md-button ml5 fl jm_md_button jm_but_color">
        </div>

        <div class="clgxs-left fl" style="width: 30%; float: left;">
            <div class="clgxs-left-main">
                <div class="clgxs-left-caidan-body">
                    <div class="clgxs-left-banner" id="cdbox2">
                        <!--菜单开始-->
                        @foreach (var item in Model.LiTADictionariesM.Where(s => s.GroupCode == "FZF"))
                        {
                            <div class="clgxs-left-banner1 wid95 contentbox0" style="width: 100%;">
                                <!--一级-->
                                <ul class="clear">
                                    <li class="wid30 jm_wid30 teAlLe">
                                        <span class="open-icons btn-one close-icons"></span>
                                        <span class="jm_open-icons"></span>
                                        <b class="TreeLevel1">@item.Name (@(Model.LiTAStructureM.Where(s => s.DutyType == item.id).Count())/@(Model.LiTAOrganizationM.Where(s => s.DutyType == item.id).Sum(s => s.Totol)))</b>
                                    </li>
                                </ul>

                                @foreach (var item2 in Model.LiTADictionariesM.Where(s => s.GroupCode == "CPLX"))
                                {

                            <!--二级-->
                                    <div class="clgxs-left-banner2 disNon" style="display: block;">
                                        <!--二级-->
                                        <ul class="clear">
                                            <li class="wid30 jm_wid30 teAlLe">
                                                <span class="open-icons openclose btn-two close-icons"></span>
                                                <span class="jm_btn_two"></span>
                                                <b class="TreeLevel2" shortname="E01">@item2.Name<span>(@(Model.LiTAStructureM.Where(s => s.ProductId == item2.id & s.DutyType == item.id).Count()))</span></b>
                                            </li>
                                        </ul>
                                        <div class="clgxs-left-banner3 disNon" style="display: none;">
                                            @foreach (var item3 in Model.LiTAStructureM.Where(s => s.ParentId == 0 & s.ProductId == item2.id & s.DutyType == item.id))
                                            {
                                    <!--三级-->
                                                <ul class="clear">
                                                    <li class="wid30 jm_wid30 teAlLe">
                                                        <span class="open-icons openclose btn-three close-icons"></span>
                                                        <span class="jm_btn_three"></span>
                                                        <b class="TreeLevel3">@item3.Name</b>
                                                    </li>
                                                </ul>

                                                foreach (var item4 in Model.LiTAStructureM.Where(s => s.ParentId == item3.id & s.ProductId == item2.id & s.DutyType == item.id))
                                                {
                                                    <div class="clgxs-left-banner4 disNon" style="display: none;">
                                                        <!--四级-->
                                                        <ul class="clear">
                                                            <li class="wid30 jm_wid30 teAlLe">
                                                                <span class="open-icons openclose btn-fore jm_btn_fore close-icons"></span>
                                                                <b class="TreeLevel4">@item4.Name</b>
                                                            </li>
                                                        </ul>
                                                        @foreach (var item5 in Model.LiTAStructureM.Where(s => s.ParentId == item4.id & s.ProductId == item2.id & s.DutyType == item.id))
                                                        {
                                                            <div class="clgxs-left-banner5 disNon" style="display: none;">
                                                                <!--五级-->
                                                                <ul class="clear">
                                                                    <li class="wid85 teAlLe">
                                                                        <span class="openclose add-icons5 jm_btn_five btn-five" style="cursor:pointer;"></span>
                                                                        <b class="TreeLevel5">@item5.Name</b>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        }
                                                    </div>
                                                }
                                            }
                                        </div>
                                    </div>
                                }
                            </div>
                        }

                    </div><!--整体菜单结束-->
                </div><!--出现滚动条出现的结束-->
            </div>
        </div>	<!--左边部分结束-->

        <div class="table-wrapper plr10" style="float: left; width: 65%; padding-top: 10px ; padding-bottom: 20px;">
            <table class="table jm_table2 ColorTable" width="100%">
                <thead>
                    <tr>
                        <th>部门</th>
                        <th>岗位</th>
                        <th>满编</th>
                        <th>在岗</th>
                        <th>缺岗</th>
                    </tr>
                </thead>
                <tbody>

                    @foreach (KeyValuePair
<int, string>
dic in ViewBag.GetDepartment)
                    {
                        var tempLst = Model.TAStructureStatisticsM.Where(w => w.DutyType == dic.Key);

                        var index = 1;
                        foreach (var item in tempLst)
                        {
                            <tr>
                                @if (index == 1)
                                {
                                    <td rowspan="4">@(dic.Value)</td>
                                }
                                <td>@(ViewBag.GetPosition[item.Position])</td>
                                <td>@item.Totol</td>
                                <td>@item.PAmount</td>
                                <td>@(item.Totol - item.PAmount)</td>
                            </tr>
                            index++;
                        }
                        if (tempLst.Count() > 0)
                        {
                            <tr class="jm_table_hj">
                                <td>合计</td>
                                <td>@tempLst.Sum(s => s.Totol)</td>
                                <td>@tempLst.Sum(s => s.PAmount)</td>
                                <td>@(tempLst.Sum(s => s.Totol) - tempLst.Sum(s => s.PAmount))</td>
                            </tr>
                        }

                    }
                </tbody>
            </table>
        </div>
    </div>

    <!--加载 开始-->
    <div class="loading hide"></div>

    <!--弹出层  遮罩  开始-->
    <div class="alertMask"></div>

    <!--添加人员弹出层-->
    <div class="alertBox jm_alert1" id="repulseBox">
        <div class="alertTitle j_alertHeight">
            <p>添加人员</p>
            <span class="alertClose close"></span>
        </div>
        <div class="alertCon jm_alertCon">
            <table class="jm_alert_tab1" width="100%">
                <tbody>
                    <tr>
                        <td width="10%" align="right">部门：</td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_bumen" data-id="1" value="研发" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_bumen" data-id="2" value="UED" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_bumen" data-id="3" value="开发" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_bumen" data-id="4" value="测试" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_bumen" data-id="5" value="应用" />
                        </td>
                    </tr>
                    <tr>
                        <td width="10%" align="right">产品选择：</td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="1" value="商务" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="2" value="主案" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="3" value="工程" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="4" value="材料" />
                        </td>
                    </tr>
                    <tr>
                        <td width="10%" align="right"></td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="5" value="造价" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="6" value="财务" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="7" value="人事" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_chanpin" data-id="8" value="家具弱电智能硬件" />
                        </td>
                    </tr>
                    <tr>
                        <td width="10%" align="right">岗位：</td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_gangwei" data-id="1" value="经理" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_gangwei" data-id="2" value="主管" />
                        </td>
                        <td width="16%">
                            <input type="button" class="jm_butt_btn btn_gangwei" data-id="3" value="员工" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">执行人：</td>
                        <td colspan="4">
                            <div class="divshow clear">
                                <div class="labelbox fl" data-div="1">
                                    <span class="relative wrapper-span" data-id="1">
                                        <select class="input-write jm_butt_select">
                                            <option>请选择</option>
                                        </select>
                                    </span>
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="alertFoot">
            <div class="dis_il_block">
                <a href="javascript:" class=" buttonh26 button-c46a1fe table-btn fl mr10 jm_but_color" style="min-width: 40px;">确定</a>
            </div>
        </div>
    </div>

</div>
<script src="~/Scripts/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script>
<!--点击圆圈效果-->
<script src="~/Scripts/jquery.rippleria.min.js" type="text/javascript" charset="utf-8"></script>
<!--模拟滚动条-->
<script src="~/Scripts/scroll.js" type="text/javascript" charset="utf-8"></script>
<!--主导航-->
<script src="~/Scripts/main.js" type="text/javascript" charset="utf-8"></script>
<script src="~/Scripts/rxued.js" type="text/javascript" charset="utf-8"></script>
<!--placeholder-->
<script src="~/Scripts/jquery.placeholder.1.3.min.js" type="text/javascript" charset="utf-8"></script>
<!--分页-->
<script src="~/Scripts/jquery.pagination.js" type="text/javascript" charset="utf-8"></script>

<script>
    $(function () {

        //新建任务
        $("#AddUser").click(function () {
            rxued.alert.jAlert(".jm_alert1", 800);
        })



        //////////////////////////  树    形     ///////////////////////////////////

        //计算滚动条的函数
        function mainScroll() {
            var winH = $(window).height();
            //右侧的高度
            $(".clgxs-left-caidan-body").css("height", winH - 33 - $(".clgxs-left-header").outerHeight(true) - $(".clgxs-left-title").outerHeight(true) + "px")
            //右侧的高度
            $(".clgxs-right").css("height", winH - 45 + "px")
            //左侧右侧宽度

            //jm   $(".clgxs-left-title ul").css("width", $(".clgxs-left-banner1").outerWidth() + "px")
        }

        //菜单显示
        //左侧一级菜单的控制
        $("#cdbox,#cdbox2").on("click", ".btn-one", function () {
            if ($(this).parents("ul").next(".clgxs-left-banner2").css("display") == "none") {
                $(".clgxs-left-banner1").find("div").css("display", "none")
                $(".clgxs-left-banner1").find(".openclose").removeClass("close-icons")
                $(this).parents("ul").nextAll(".clgxs-left-banner2").css("display", "block");
                $(this).addClass("close-icons")
            } else {
                $(this).parents("ul").parent().find("div").css("display", "none")
                $(this).removeClass("close-icons")
            }
        });


        //左侧二级菜单的控制
        $("#cdbox,#cdbox2").on("click", ".btn-two", function () {
            if ($(this).parents("ul").next(".clgxs-left-banner3").css("display") == "none") {
                $(".clgxs-left-banner2").find("div").css("display", "none")
                $(".clgxs-left-banner2").find(".openclose").removeClass("close-icons")
                $(this).parents("ul").nextAll(".clgxs-left-banner3").css("display", "block")
                $(this).addClass("close-icons")
            } else {
                $(this).parents("ul").parent().find("div").css("display", "none")
                $(this).removeClass("close-icons")
            }
        })

        //左侧三级菜单的控制
        $("#cdbox,#cdbox2").on("click", ".btn-three", function () {
            if ($(this).parents("ul").next(".clgxs-left-banner4").css("display") == "none") {
                $(".clgxs-left-banner3").find("div").css("display", "none")
                $(".clgxs-left-banner3").find(".openclose").removeClass("close-icons")
                $(this).parents("ul").nextAll(".clgxs-left-banner4").css("display", "block")
                $(this).addClass("close-icons")
            } else {
                $(this).parents("ul").parent().find("div").css("display", "none")
                $(this).removeClass("close-icons")
            }
        })
        //左侧四级菜单的控制
        $("#cdbox,#cdbox2").on("click", ".btn-fore", function () {
            if ($(this).parents("ul").next(".clgxs-left-banner5").css("display") == "none") {
                $(".clgxs-left-banner4").find("div").css("display", "none")
                $(".clgxs-left-banner4").find(".openclose").removeClass("close-icons")
                $(this).parents("ul").nextAll(".clgxs-left-banner5").css("display", "block")
                $(this).addClass("close-icons")
            } else {
                $(this).parents("ul").parent().find("div").css("display", "none")
                $(this).removeClass("close-icons")
            }
        })
    })
</script>



